<#assign _topPage=true>
<#include '/pages/taglib/core.ftl'>
<#include "/pages/taglib/common.ftl">
<#include '/pages/taglib/container.ftl'>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<#assign us = fn.service('user')>
<#assign currentWebsite = us.currentWebsite?if_exists.name!''>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
		<title><@i18n name="site." + currentWebsite/></title>
        <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
<body class="espirit _common">
	<@header topPage=_topPage/>
	<@css src="/static/espirit/styles/jespirit.css" async=false/>
	<@script src="/static/espirit/scripts/espirit.js" async=true/>

<#if actionErrors?exists && actionErrors?size gt 0>
	<div class="error">
		<#list actionErrors as error>
			${error!}<br>
		</#list>
	</div>
<#else>

<#-- FIXME: REMOVE the template check in future -->
<#if fn.hasPage('/espirit/index.execute')>
	<@cs.include genDir=true page="/pageGen/espirit/index.execute.ftl">
		<@cs.extends target="id='menuCtn'">
			<#if layout_north>
			<div class="ui-layout-north">
				<div class="headerCtn" id="headerCtn">
					<#include 'espirit.menu.top.ftl'>
				</div>
			</div>
			<#else>
			<div class="ui-layout-west">
				<#include 'espirit.menu.left.ftl'>
			</div>
			</#if>
		</@cs.extends>
	</@cs.include>
<#else>
	<div class="rootlayout">
		<#assign useTopMenu = fn.service('espirit.hr.hrSetting').getHrSetting().getTopMenu()>
		<#if useTopMenu>
			<#include 'espirit.menu.top.ftl'>
		<#else>
			<#include 'espirit.menu.left.ftl'>
		</#if>
		<div class="mainCtn<#if !useTopMenu> withLeftMenu</#if>" id="mainCtn"><div>
			<@tab id="g_mainPanel" name="g_mainPanel" labels=mainPanelLabels urls=mainPanelLinks enableClose=true>
			</@tab>
		</div></div>
	</div>
</#if>

<div id="gotoTop" class="gotop">
	<a href='javascript:$("html,body").animate({scrollTop: 0}, 10);void(0);'>
		<i class="ii"></i>
	</a>
</div>

<#-- 
<object data="${base}/scripts/zoom.swf?onchange=onZoomChange" style="display:none" width="10" height="10" id="accessory_zoom" name="zoom_detect" type="application/x-shockwave-flash">
	<param name="allowScriptAccess" value="always">
	<param name="wmode" value="transparent">
	<param name="scale" value="noScale">
</object>
-->
<script>
	$(document).ready(function() {
		// jump to the child page if possible
		<#assign subpage = Parameters.subpage!>
		<#if subpage != ''>
			var subpage = '${fn.encodeHTML(subpage)}';
			var subpageTitle = '${fn.encodeHTML(Parameters.subpageTitle!)}';
			openMainTab(subpage, subpageTitle);
		</#if>
		
		// main tab trace
		<#assign hasPermission = us.hasLinkPermission(fn.linkNoBase('/espirit/eap/pagelayout/page._add',true), false)>
		when('initIndexPage', function() {
			initIndexPage(${useTopMenu?string}, ${hasPermission?string});
		})
	});
</script>


</#if><#-- error end -->
	
	<@footer/>
</body>
</html>